﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SAHM
{
    public struct AnalyticsScripts
    {
        public const string google = @"
            <script type=""text/javascript"">
              var _gaq = _gaq || [];
              _gaq.push(['_setAccount', '{0}']);
              _gaq.push(['_trackPageview']);

              (function() {{
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
              }})();

            </script>
        ";

        public const string piwki = @"
            <!-- Piwik -->
            <script type=""text/javascript"">
                var pkBaseURL = ((""https:"" == document.location.protocol) ? ""https://{0}"" : ""http://{0}"");
                document.write(unescape(""%3Cscript src='"" + pkBaseURL + ""piwik.js' type='text/javascript'%3E%3C/script%3E""));
            </script>
            <script type=""text/javascript"">
                try 
                {{
                    var piwikTracker = Piwik.getTracker(pkBaseURL + ""piwik.php"", {1});
                    piwikTracker.trackPageView();
                    piwikTracker.enableLinkTracking();
                }} 
                catch( err ) 
                {{
                }}
            </script>
            <noscript>
                <p><img src=""http://www.ljrahier.be/piwik/piwik.php?idsite={1}"" style=""border:0"" alt="""" /></p>
            </noscript>
            <!-- End Piwik Tag -->
            ";

        public const string uservoice = @"
            <script type=""text/javascript"">
            var uservoiceOptions = {{
              /* required */
              key: '{0}',
              host: '{0}.uservoice.com', 
              forum: '{1}',
              showTab: true,  
              /* optional */
              alignment: '{2}',
              background_color:'{3}', 
              text_color: '{4}',
              hover_color: '{5}',
              lang: '{6}'
            }};

            function _loadUserVoice() {{
              var s = document.createElement('script');
              s.setAttribute('type', 'text/javascript');
              s.setAttribute('src', (""https:"" == document.location.protocol ? ""https://"" : ""http://"") + ""cdn.uservoice.com/javascripts/widgets/tab.js"");
              document.getElementsByTagName('head')[0].appendChild(s);
            }}
            _loadSuper = window.onload;
            window.onload = (typeof window.onload != 'function') ? _loadUserVoice : function() {{ _loadSuper(); _loadUserVoice(); }};
            </script>
        ";


        public const string owa = @"
            <!-- Start Open Web Analytics Tracker -->
            <script type=""text/javascript"">
            //<![CDATA[
            var owa_baseUrl = '{0}';
            var owa_cmds = owa_cmds || [];
            owa_cmds.push(['setEndpoint', owa_baseUrl]);
            owa_cmds.push(['setSiteId', '{1}']);
            owa_cmds.push(['trackPageView']);
            owa_cmds.push(['trackClicks']);
            owa_cmds.push(['trackDomStream']);

            (function() {{
	            var _owa = document.createElement('script'); _owa.type = 'text/javascript'; _owa.async = true;
	            _owa.src = owa_baseUrl + 'modules/base/js/owa.tracker-combined-min.js';
	            var _owa_s = document.getElementsByTagName('script')[0]; _owa_s.parentNode.insertBefore(_owa, _owa_s);
            }}());
            //]]>
            </script>
            <!-- End Open Web Analytics Code -->
            ";
    }
}
